JSModel = new function() {
	/**
	 * JQuery提示框	 */
	this.JQuery = new function() {
		this.alert = function(msg, func){		
			$("body").append("<div id='jquery_Dialog' style='display:none;' title='提示消息'>" +
					"<p><span id='jquery_DialogMsg'>"+msg+"</span>" +
					"</p></div>");
			$('#jquery_Dialog').dialog({
				autoOpen: true,
				width: 350,
				minHeight: 220,
				modal: true,
				close: function(){
					$("#jquery_Dialog").remove();
					if (typeof func == "function")
						func();
				},
				buttons: {
					"确定": function() {
						$(this).dialog("close");
					}
				}
			});
		};
		
		this.confirm = function(msg,func){	
			$("body").append("<div id='jquery_Dialog' style='display:none;' title='提示消息'>" +
					"<p><span id='jquery_DialogMsg'>"+msg+"</span>" +
					"</p></div>");
			$('#jquery_Dialog').dialog({
				autoOpen: true,
				width: 350,
				height: 220,
				modal: true,
				close: function(){
					$("#jquery_Dialog").remove();
				},
				buttons: {
					"确定": function() {
						$(this).dialog("close");
						return func();
					},
					"取消": function() {
						$(this).dialog("close"); 
					}
				}
			});
		};
		
		
		
		/* type:
			ban  禁止 
			doubt  疑问
			success  成功
			error 错误
			warn 警告
		 */
		this.showMsg = function(msg,type,func,paramstmp){
			var params={
				timeout:1200
			};
			if(paramstmp){
				//if(paramstmp.width != null && paramstmp.width != "")
				//	params.width = paramstmp.width;
				if(paramstmp.timeout != null && paramstmp.timeout != "")
					params.timeout = paramstmp.timeout;
			}
			type = (type == null ? "warn" : type);
			type = (type == "success" ? "right" : type);
			if($("#jquery_Dialog_Msg").length == 0){
				$("body").append("<div id='jquery_Dialog_Msg' class='tip_box' style='z-index:99999; position:fixed; top:250px; width:220px;display:none;'>" +
						"<div class='rf "+type+"_inco'></div><div class='txt1 gray'>"+msg+"</div><div class='clear'></div></div>");
			}
			//$("#jquery_Dialog_Msg").css("top", (document.body.offsetHeight/2-150 )  + document.body.scrollTop);
			$("#jquery_Dialog_Msg").css("left",(document.body.offsetWidth - 200) / 2);
			
			$('#jquery_Dialog_Msg').fadeIn("normal",function(){
				$('body').oneTime(params.timeout,function(){
					$("#jquery_Dialog_Msg").fadeOut("normal",function(){
						$("#jquery_Dialog_Msg").remove();
						return func;
					});
				});
			});
		};
	};
};//.fadeIn()
/**
 * 转义
 */
stringTrope = function(str) {
	if(null!=str){
		return str.replace(new RegExp("'","g"),"&#039;");
	}else{
		return "";
	}
};
//入文本框时需反转义
stringGoBackTrope = function(str) {
	if(null!=str){
		return str.replace(new RegExp("&#039;","g"),"'");
	}else{
		return "";
	}
};


stringTropeAll = function(str) {
	if(null!=str){
		return str.replace(new RegExp("<","g"),"&lt;")
				.replace(new RegExp(">","g"),"&gt;")
				.replace(new RegExp("'","g"),"&#039;")
				.replace(new RegExp("\"","g"),"&quot;");
	}else{
		return "";
	}
};
stringGoBackTropeAll = function(str) {
	if(null!=str){
		return str.replace(new RegExp("&lt;","g"),"<")
			.replace(new RegExp("&gt;","g"),">")
			.replace(new RegExp("&#039;","g"),"'")
			.replace(new RegExp("&quot;","g"),"\"");
	}else{
		return "";
	}
};

filterHTML = function(str) {
	if(null!=str){
		return str.replace(/<.*?>/g,"").replace(new RegExp("&ensp;","g")," ").replace(new RegExp("&emsp;","g")," ").replace(new RegExp("&nbsp;","g")," ");
	}else{
		return "";
	}
};

filterHtmlRuleA = function(str) {
	if(null!=str){
		var regstr = new RegExp("<a [^>]+>","gim");
		var a_regstr = new RegExp("href=[\'\"].+[\'\"]");
		str = str.replace(/<([^a]?[^\/a])[^>]+>/gi,"").replace(new RegExp("&ensp;","g")," ").replace(new RegExp("&emsp;","g")," ").replace(new RegExp("&nbsp;","g")," ");
		var result_tag = str.match(regstr);
		if(null != result_tag){
			for(var i=0; i<result_tag.length; i++){
				var result_tag2 = result_tag[i].match(a_regstr);
				if(null != result_tag2 && result_tag2.length > 0){
					str = str.replace(result_tag[i],'<a '+result_tag2[0].replace(/\'/g,"\"")+'>');
				}else{
					str = str.replace(result_tag[i],"");
				}
	        }
		}
		return str;
	}
	return "";	
};

//去头尾换行符
filterBrTag = function(str){
	if(null != str)
		return str.replace(/^<br[ ]?[\/]?>+|<br[ ]?[\/]?>+$/g,"");
	else
		return "";
};

stringUtil = function(str, rel){
	if(rel == null)
		rel="";
	return (str == null || str == "") ? rel : str;
};

//截取字符串
stringEllipsis = function(str, len){
	if(null != str){
		var result_str = '';//截取的结果
		var pattern =/^([\u4E00-\u9FA5]|[\uFE30-\uFFA0])*$/; 
		var _cur_length = 0;//当前截取的长度
		for (var i = 0; i < str.length; i++){
			if(_cur_length < len){
				var tmpstr = str.charAt(i);
				if(pattern.test(tmpstr)) {
					_cur_length += 2;
				}else{
					_cur_length += 1;
				}
				result_str += tmpstr;
			}else{
				return result_str+"...";
			}
		}
		return result_str;
	}else{
		return str = '';
	}
};

stringIsNull = function(str){
	if(str == null || str == "")
		return true;
	else return false;
};

replaceSearchText = function(value,repValue, className){ 
    return outPut; 
};